﻿using System;
using System.Collections.Specialized;

namespace MyBatis.Data.Model
{
	/// <summary>
	/// 分页基础表
	/// </summary>
	[Serializable]
	public abstract class QPBase : HybridDictionary
    {
        #region 分页

        public int PageIndex
        {
            get
            {
                return int.Parse((this["PageIndex"] ?? 1).ToString());
            }
            set
            {
                this["PageIndex"] = value;
                this["SkipNum"] = (this.PageIndex - 1) * this.PageSize;
            }
        }


        public int PageSize
        {
            get
            {
                return int.Parse((this["PageSize"] ?? 10).ToString());
            }
            set
            {
                this["PageSize"] = value;
                this["SkipNum"] = (this.PageIndex - 1) * this.PageSize;
            }
        }

        /// <summary>
        /// 要跳过的记录数
        /// </summary>
        public int SkipNum
        {
            get
            {
                return int.Parse((this["SkipNum"] ?? 0).ToString());
            }
            set { this["SkipNum"] = value; }
        }

        public int ItemCount { get; set; }

        public bool IsReset { get; set; }

        #endregion

        #region 排序

        public string OrderSort
        {
            set
            {
                this["OrderSort"] = value;
            }
        }

        #endregion
    }
}

